#include <bits/stdc++.h>
using namespace std;

#define ll long long

ll res = 0; //计算总的结果
int cnt[34+1];
//cnt[i], 的意思是 i这张牌，被发了cnt[i]次
//其中i属于[1-27]为数字牌，[28-34]为汉字牌

int shun_left_bound[] = {1,2,3,4,5,6,7, 10,11,12,13,14,15,16, 19,20,21,22,23,24,25};
//顺子是三个连续的，所以三个连续的左边界的取值只能是[1-7], [10-16], [19-25]
vector<int> dui_position;
//计算顺序：先算顺子 然后算对子，然后算刻子

void reset_cnt(){ //重置
	memset(cnt,0,sizeof(cnt));
}

void disp_cnt(){ //调试用，展示当前发牌情况
	cout << "-------";
	for ( int i=1; i<=34; i++ ){
		cout << cnt[i] << ' ';
	}
	cout << "-------";
	cout << '\n';
}

//-------顺子↓-------
void select_shun( int l ){ //选一个顺子，传入这个三个连续数字的最小的那个数字
	cnt[l]++; cnt[l+1]++; cnt[l+2]++;
}
//-------顺子↑-------

//-------对子↓-------
int res_dui(){
	int ret = 0;
	for ( int i=1; i<=34; i++ ){
		if ( cnt[i]<=2 ) ret++;	
	}
	return ret;
}

void generate_dui_position(){
	dui_position.clear();
	for ( int i=1; i<=34; i++ ){
		if ( cnt[i]<=2 ) dui_position.push_back(i);
	}
}

void select_dui( int l ){
	cnt[l] += 2;
}
//-------对子↑-------

//-------刻子↓-------
ll com( ll n, ll m ){ //组合数
	ll res = 1;
	for ( int i=n; i>=n-m+1; i-- ) 
		res *= i;
	for ( int i=m; i>=1; i-- )
		res /= i;
	return res;
}

int res_ke( int cnt_ke ){ 
	int ret = 0;
	for ( int i=1; i<=34; i++ ){
		if ( cnt[i]<=1 ) ret++; 
	}
	return com(ret,cnt_ke);
}
//-------刻子↑-------

signed main(){
	//	cout << "test_com: " << com(6,1);

	
	
	//4 shun 0 ke： 
	ll res_4shun_0ke = 0;
	for ( int shun1: shun_left_bound ){
		for ( int shun2: shun_left_bound ){
			for ( int shun3: shun_left_bound ){
				for ( int shun4: shun_left_bound ){
					reset_cnt();
					select_shun(shun1);select_shun(shun2);select_shun(shun3);select_shun(shun4);
					generate_dui_position();
					for ( int dui1: dui_position ){
						//cout << shun1 << ',' << shun2 << ',' << shun3 << ' ' << dui1 << '\n';
						res_4shun_0ke++;
					}
				}
			}
		}
	}
	
		
	//3 shun 1 ke： 
	ll res_3shun_1ke = 0;
	for ( int shun1: shun_left_bound ){
		for ( int shun2: shun_left_bound ){
			for ( int shun3: shun_left_bound ){
				reset_cnt();
				select_shun(shun1);select_shun(shun2);select_shun(shun3);
				generate_dui_position();
				for ( int dui1: dui_position ){
//					cout << shun1 << ',' << shun2 << ',' << shun3 << ' ' << dui1 << '\n';
					select_dui(dui1);
					res_3shun_1ke += res_ke(1);
				}
			}
		}
	}
	
	ll res_2shun_2ke = 0;
	for ( int shun1: shun_left_bound ){
		for ( int shun2: shun_left_bound ){
			reset_cnt();
			select_shun(shun1);select_shun(shun2);
			generate_dui_position();
			for ( int dui1: dui_position ){
				//cout << shun1 << ',' << shun2 << ' ' << dui1 << '\n';
				select_dui(dui1);
				res_2shun_2ke += res_ke(2);
			}
		}
	}
	
	cout << "res_4shun_1ke = " << res_4shun_0ke << '\n';
	cout << "res_3shun_1ke = " << res_3shun_1ke << '\n';
	cout << "res_2shun_2ke = " << res_2shun_2ke << '\n';
	
	
	
}
